const http = require('http');

const server = http.createServer((request,response) => {
    //获得请求方式
    let method = request.method;
    //获得请求路径
    let url = new URL(request.url,'http://localhost:9000');
    let pathname = url.pathname;
    if (method === 'GET' && pathname === '/login') { //请求方式一定要是大写
        response.end('登陆页面');
    } else if (method === 'GET' && pathname === '/reg') {
        response.end('注册页面');
    } else {
        response.end('Not Found');
    }
});

server.listen(9000,() => {
    console.log('服务已经启动 9000端口已经启动....')
});